<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/11
 * Time: 12:20
 */

use common\components\helpers\Fun;
use yii\helpers\Html;
use common\components\widgets\Datetimepicker;
use doumiaoduo\layer\LayerConfirmWidget;
use doumiaoduo\layer\LayerIframeWidget;

LayerConfirmWidget::widget();
LayerIframeWidget::widget();
Datetimepicker::widget(['flag' => 'timepicker']);
?>
<div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height">
    <div id="search-area" class="yx-bgf7f7f7 yx-radius5 zx-mg yx-function2 yx-pr0">
        <div class="yx-floatl">
            <?= Html::beginForm(Fun::url(['isusercommission/index']), 'get', ['enctype' => 'multipart/form-data']) ?>
            <?= \common\components\helpers\Search::textInput('start_time', $date['start'], ['label' => '开始日期', 'class' => 'timepicker yx-input-text zx-width150 yx-ml6']); ?>
            <?= \common\components\helpers\Search::textInput('end_time', $date['end'], ['label' => '结束日期', 'class' => 'timepicker yx-input-text zx-width150 yx-ml6']); ?>
            <?= \common\components\helpers\Search::textInput('orders', null, ['label' => '订单号', 'class' => 'yx-input-text zx-width150 yx-ml6']); ?>
            <?= \common\components\helpers\Search::dropDownList('depositLog', null, [null => '请选择', 0 => '未结算', 1 => '已结算'], ['label' => '结算状态', 'promote' => '请选择', 'class' => 'search diy_select_txt']) ?>
            <?= \common\components\helpers\Search::submitButton('搜索', ['id' => 'search-handle', 'class' => "yx-search yx-radius2"]); ?>
            <?php Html::endForm() ?>
        </div>
        <div class="yx-floatr">
            <a href="/isusercommission-index?<?= $_SERVER['QUERY_STRING'] ?>"><?= \common\components\helpers\Search::Button('返回', ['id' => 'search-handle', 'class' => "yx-search yx-radius2"]); ?></a>
        </div>
        <div class="yx-clear"></div>
    </div>
    <div class="docs-main">
        <table id="tablesaw" class="tablesaw table yx-table1 yx-table5 table-striped with-check"
               data-tablesaw-mode="swipe" data-tablesaw-minimap>
            <thead>
            <tr class="yx-bgd2f6ec">
                <th>序号</th>
                <th>订单</th>
                <th>时间</th>
                <th>结算状态</th>
                <th>发卡人</th>
                <th>订单金额</th>
                <th>结算金额</th>
                <th>操作</th>
            </tr>
            <?php foreach ($data_arr as $k => $v) { ?>
                <tr>
                    <td><?= $k + 1 ?></td>
                    <td><?= $v['orders'] ?></td>
                    <td><?= $v['created_at'] ?></td>
                    <td><?= $v['status'] ?></td>
                    <td><?= $v['salesman'] ?></td>
                    <td><?= $v['settlement_amount'] ?></td>
                    <td><?= $v['commission_money'] ?></td>
                    <td>
                        <?php if($v['status_n'] == 0){ ?>
                        <a class="btn yx-radius2 yx-d-card yx-bg65d1d4"
                           href="<?= Fun::url(['isusercommission/balance', 'orders_commission_id' => $v['id']]) ?>"
                           rel="action-handle" data-options="plain:true,selected:true" data-action="update"">结算</a>
                        <?php }else{ ?>
                            <a class="btn yx-radius2 yx-d-card yx-bg65d1d4"
                               href="<?= Fun::url(['isusercommission/detailshistory', 'orders_commission_id' => $v['id']]) ?>"
                               rel="action-handle" data-options="plain:true,selected:true" data-action="update"">结算历史</a>
                        <?php } ?>
                    </td>
                </tr>
            <?php } ?>
            </thead>
        </table>
    </div>
</div>